import { SystemJS } from "../s";
import { IMPORT_MAP } from "../common";
import { getOrCreateLoad } from "../system-core";

export const instantiate = async function (this: SystemJS, url: string) {
    var preloads = this[IMPORT_MAP].depcache[url];
    if (preloads) {
        for (var i = 0; i < preloads.length; i++)
            await getOrCreateLoad(this, this.resolve(preloads[i], url)!, url);
    }
};
